<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>

  <body>
    <div class="container">
      <div class="helps">我的兵营{{user_id}}</div>
      <div class="dataList">
        {{each MyData val}}
        <div class="data">
          {{if val.name == "士兵"}}
          <div>名字:{{val.name}}</div>
          <div>数量:{{val.num}}</div>
          {{else}}
          <div>名字:{{val.name}}</div>
          <div>等级:{{val.level}}</div>
          <div>类型:{{val.type}}</div>
          <div>武力:{{val.atk}}({{val.increase_atk}})</div>
          <div>智力:{{val.iq}}({{val.increase_iq}})</div>
          <div>防御:{{val.def}}({{val.increase_def}})</div>
          <div>星级:{{val.collection}}</div>
          <div class="exp-bar">
            <progress
              id="exp"
              value="{{val.nowexp}}"
              max="{{val.needexp}}"
            ></progress>
            <span id="exp-percentage"
              >{{(val.nowexp/val.needexp*100).toFixed(2)}}%</span
            >
          </div>
          {{/if}}
        </div>
        {{/each}}
      </div>
    </div>
  </body>

  <style>
    body {
      height: 50%;
      transform: scale(1);
      background: url('@/resources/assets/img/help/help.png');
      background-size: 100% auto;
    }

    * {
      padding: 0;
      margin: 0;
    }

    .container {
      width: 100%;
      padding: 20px;
    }

    .helps {
      color: #fff;
      font-size: 42px;
      width: 70%;
      border-radius: 20px;
      text-align: center;
      margin: 50px auto;
      background: rgba(78, 79, 81, 0.7);
      font-weight: 900;
    }

    .dataList {
      width: 100%;
      height: 100%;
      display: flex;
      flex-wrap: wrap;
    }

    .data {
      width: 30%;
      display: inline-block;
      margin: 10px;
      min-height: 100px;
      padding: 10px;
      text-align: center;
      box-sizing: border-box;
      border-radius: 20px;
      background-color: #4e4f51b3;
    }

    .dataList .data div {
      color: #fff;
      font-size: 20px;
      line-height: 20px;
    }

    .dataList .data div:nth-of-type(1) {
      font-size: 26px;
      font-weight: bold;
      line-height: 30px;
    }

    .dataList .data div:nth-of-type(2) {
      font-size: 22px;
      font-weight: bold;
      line-height: 26px;
    }

    .exp-bar {
      display: flex;
      border: 3px solid #808080;
      align-items: center;
      border-radius: 10px;
    }

    #exp {
      width: 80%;
      margin-right: 10px;
      border: 1px solid #000;
      border-radius: 10px;
      appearance: none;
    }

    #exp::-webkit-progress-bar {
      border-radius: 10px;
      background-color: #ddd;
    }

    #exp::-webkit-progress-value {
      border-radius: 10px;
      background: linear-gradient(to right, #4caf50, #ff0000);
    }

    #exp-percentage {
      width: 20%;
    }
  </style>
</html>
